//
//  SCShopInfoCollectionViewCell.m
//  LastOne
//
//  Created by dllo on 15/11/7.
//  Copyright © 2015年 sc. All rights reserved.
//

#import "SCShopInfoCollectionViewCell.h"
#import "NightHeader.h"
#import "FitHeader.h"
@interface SCShopInfoCollectionViewCell ()
@property(nonatomic, assign)CGRect rect;
@end
@implementation SCShopInfoCollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        self.rect = self.contentView.frame;
        
        _imageView = [[UIImageView alloc] init];
        [self addSubview:_imageView];
        
        _nameLabel = [[UILabel alloc] init];
        _nameLabel.numberOfLines = 2;
        [_nameLabel NightWithType:UIViewColorTypeNormal];
        _nameLabel.font = [UIFont systemFontOfSize:15 * FitWidth];
        [self addSubview:_nameLabel];
        
        _priceLabel = [[UILabel alloc] init];
        _priceLabel.textColor = [UIColor redColor];
        _priceLabel.font = [UIFont systemFontOfSize:13 * FitWidth];
        _priceLabel.textAlignment = 2;
        [self addSubview:_priceLabel];
        
        _priceOffLabel = [[UILabel alloc] init];
        _priceOffLabel.textColor = [UIColor redColor];
        _priceOffLabel.font = [UIFont systemFontOfSize:11 * FitWidth];
        [self addSubview:_priceOffLabel];
    }
    return self;
}

-(void)setKind:(FYShopInfoCollectionViewKind)kind
{
    switch (kind) {
        case 0:
            _imageView.frame = CGRectMake(3 * FitWidth, 3, (self.frame.size.height - 6 * FitWidth) / 3 * 4, self.frame.size.height - 6 * FitHeight);
            _nameLabel.frame = CGRectMake(_imageView.frame.origin.x + _imageView.frame.size.width + 5 * FitWidth, _imageView.frame.origin.y, self.rect.size.width - 5 * FitWidth * 4 - _imageView.frame.size.width, 50 * FitHeight);
            _priceOffLabel.frame = CGRectMake(_nameLabel.frame.origin.x, 80 * FitHeight, 100 * FitWidth, 10 * FitHeight);
            _priceLabel.frame = CGRectMake(self.rect.size.width - 120 * FitWidth, 75 * FitHeight, 115 * FitWidth, 20 * FitHeight);
            break;
        case 1:
            _imageView.frame = CGRectMake(3, 3 * FitHeight, (self.frame.size.height - 6 * FitWidth) / 3 * 4, self.frame.size.height - 6 * FitHeight);
            _nameLabel.frame = CGRectMake(_imageView.frame.origin.x + _imageView.frame.size.width + 3 * FitWidth, _imageView.frame.origin.y, self.rect.size.width - 5 * FitWidth * 4 - _imageView.frame.size.width, 25 * FitHeight);
            _nameLabel.numberOfLines = 1;
            _nameLabel.font = [UIFont systemFontOfSize:15 * FitWidth];
            _priceOffLabel.frame = CGRectMake(_nameLabel.frame.origin.x, self.frame.size.height - 18 * FitHeight, 100 * FitWidth, 15 * FitHeight);
            _priceOffLabel.textColor = [UIColor grayColor];
            _priceOffLabel.font = [UIFont systemFontOfSize:13 * FitWidth];
            break;
            
        default:
            break;
    }
}

@end
